#include "struct_define.fx"
#include "const_define.fx"

texture texture0 = NULL;
sampler SamplerTexture0 = sampler_state
{
	Texture = <texture0>;
	AddressU = WRAP;
	AddressV = WRAP;
	MipFilter = Linear;
	MinFilter = Linear;
	MagFilter = Linear;
};

PSO PS(VSO IN)
{
	PSO OUT;
	OUT.color = IN.color * tex2D(SamplerTexture0, IN.texCoord);
	return OUT;
}

PSO PS_FOG(VSO_FOG IN)
{
	PSO OUT;
	float4 color = IN.color * tex2D(SamplerTexture0, IN.texCoord);
	OUT.color = lerp(color, fogColor, IN.fog);
	OUT.color.a = color.a;
	return OUT;
}


PSO PS_SHADOW(VSO_PUV IN)
{
	PSO OUT;
	float shadow = CalcShadow(IN.texProj);
	OUT.color = IN.color * tex2D(SamplerTexture0, IN.texCoord) * shadow;
	return OUT;
}

PSO PS_FOG_SHADOW(VSO_PUV_FOG IN)
{
	PSO OUT;
	float shadow = CalcShadow(IN.texProj);
	float4 color = IN.color * tex2D(SamplerTexture0, IN.texCoord) * shadow;
	OUT.color = lerp(color, fogColor, IN.fog);
	OUT.color.a = color.a;
	return OUT;
}

PSO PS_NORMAL_SHADOW_CAST(VSO_SHADOW IN)
{
	PSO OUT;
	OUT.color = IN.depth.x / IN.depth.y;
	return OUT;
}